package com.example.examsystem.model;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 考试答案实体类
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "exam_answers")
public class ExamAnswer extends BaseEntity {
    
    @Column(name = "exam_record_id", nullable = false)
    private Long examRecordId;
    
    @Column(name = "question_id", nullable = false)
    private Long questionId;
    
    @Column(name = "answer", columnDefinition = "TEXT")
    private String answer;
    
    @Column(name = "is_correct")
    private Boolean isCorrect;
    
    @Column(name = "score", precision = 8, scale = 2)
    private java.math.BigDecimal score;
    
    // 关联关系
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "exam_record_id", insertable = false, updatable = false)
    private ExamRecord examRecord;
    
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "question_id", insertable = false, updatable = false)
    private Question question;
}




